package com.huage_07.lesson_07;

import java.util.Random;
import java.util.Scanner;

public class GuessNumber {
    public static void start(){
        Random random = new Random();
        int n = random.nextInt(100)+1;
        while (true){
            Scanner sc = new Scanner(System.in);
            System.out.println("请输入你要猜的数字[1-100]:");
            int num = sc.nextInt();
            if(num>n){
                System.out.println("你猜大了，请重新再猜！");
            }else if(num<n){
                System.out.println("你猜小了，请重新再猜！");
            }else if(num==n){
                System.out.println("恭喜你猜对了");
                break;
            }
        }
    }
}
